    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>checkbox勾选</title>
    </head>
    <style type="text/css">
        table{
            margin: 150px auto;
            border: 1px solid #000000;
            background: #fff;
            border-collapse: collapse;
            font-size: 24px;
        }
        tr,td{
            border: 1px solid #000000;

        }
        #head_all{
            background: #7AB800;
        }

    </style>
    <script src="jquery.js"></script>
    <script>
        $(document).ready(function () {
            $("#allNumber").click(function () {
                $("#head_every input:checkbox").prop("checked",$(this).prop("checked"));
            });
            console.log($("#head_every input:checkbox").length);

            $("#head_every input:checkbox").click(function (){
//                console.log($("#head_every input:checkbox").length);
                console.log($("#head_every input:checked").length);
                if (($("#head_every input:checkbox").length===$("#head_every input:checked").length)){
                    $("#allNumber").prop("checked",true);
//                    alert('000');
                }else{
                    $("#allNumber").prop("checked",false);
                }
            });
        });
    </script>
    <body>
     <table>
         <thead id="head_all">
         <tr>
             <td><input type="checkbox" id="allNumber"></td>
             <td>姓名</td>
             <td>球衣号码</td>
         </tr>
         </thead>
         <tbody id="head_every">
         <tr>
             <td><input type="checkbox"></td>
             <td>梅西</td>
             <td>10号</td>
         </tr>
         <tr>
             <td><input type="checkbox"></td>
             <td>大卫席尔瓦</td>
             <td>21号</td>
         </tr>
         <tr>
             <td><input type="checkbox"></td>
             <td>萨内</td>
             <td>19号</td>
         </tr>
         <tr>
             <td><input type="checkbox"></td>
             <td>德布劳内</td>
             <td>17号</td>
         </tr>
         </tbody>
     </table>
    </body>
    </html>